﻿@using Promocot.Models;
@{
    List<Clasificacion> clasificaciones = (new ClientomaticDBContainer()).ClasificacionSet.ToList<Clasificacion>();
    List<SelectListItem> elstatus = new List<SelectListItem>();
    elstatus.Add(new SelectListItem() { Text = "-1", Value = " " });
    elstatus.Add(new SelectListItem() { Text = "0", Value = "Borrador" });
    elstatus.Add(new SelectListItem() { Text = "1", Value = "Plantilla" });
    elstatus.Add(new SelectListItem() { Text = "2", Value = "Enviado" });
    elstatus.Add(new SelectListItem() { Text = "3", Value = "Rechazado" });
    elstatus.Add(new SelectListItem() { Text = "4", Value = "Aprobado" });
}
<!DOCTYPE html>
<html>
<head>
    <meta name="Description" content="Promocion, Cotizacion, sistema de Promociones y Ctizaciones" />
    <meta name="Keywords" content="Promocion, Cotizacion, Passarini, Boletos Travel" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="Distribution" content="Global" />
    <meta name="Author" content="McArthur Leger - mleger45@gmail.com" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/MarketPlace.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/jquery.windows-engine.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/jquery.treeview.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/screen.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jqueryupload1.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jqueryuiminupload.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.tmpl.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.windows-engine.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.jqDock.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.jqDock.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.tablePagination.0.4.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.tools.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.cookie.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.treeview.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.treeview.edit.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
</head>
<body>
    <!-- wrap starts here -->
    <div id="wrap">
        @{Html.RenderPartial("~/Views/Shared/header.cshtml");}
        <!-- Messages Area-->
        @if (ViewBag.mensajes != null)
        {
     
            <div id="mensajes">
                <ul style="list-style-type: none;">
                    <li>@ViewBag.mensajes</li>
                </ul>
            </div>
        }
        <!-- content-wrap starts -->
        <div id="content-wrap" class="two-col">
            @{
      
                if (Session.Count > 0)
                {
                    
                    <script type="text/javascript">
                        $(function () {
                            $.ajax({
                                url: 'Sesion/conectado',
                                success: function (data) {
                                    $('#asesores option[value='+data+']').attr('selected', 'selected');
                                }
                            })
                        });
                    </script>
                    	
                
                <div id="sidebar">
                    @{
                    if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString() == "Promocion")
                    {
                    
                    
                        <h1 style="text-align: center;">
                            Módulo de Promociones</h1>
                        <ul class="sidemenu">
                            <li>@Html.ActionLink("Datos de perfil", "perfil", "Sesion")</li>
                            @if (Session["empresa"].Equals("passarini"))
                            {
                                <li>@Html.ActionLink("Promociones passarini", "Index", "Promocion")</li>
                                <li>@Html.ActionLink("Nueva Promo Passarini", "Creap", "Promocion")</li>
                    
                                if (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.Equals("Index") || ViewContext.Controller.ValueProvider.GetValue("action").RawValue.Equals("BuscarPromo") && ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.Equals("Promocion"))
                                {
                                <li>
                                    <ul id="browser">
                                        @foreach (var cla in clasificaciones)
                                        {
                                            if (cla.cod_clasificacion_padre == 1)
                                            {
                                            <li><span class="folder">@Html.ActionLink(cla.nombre, "BuscarPromo/" + cla.cod_clasificacion, "Promocion")</span>
                                                @if (cla.nivel)
                                                {
                                                    <ul>
                                                        @foreach (var cla1 in clasificaciones)
                                                        {
                                                            if (cla1.cod_clasificacion_padre == cla.cod_clasificacion)
                                                            {
                                                            <li><span class="folder">@Html.ActionLink(cla1.nombre, "BuscarPromo/" + cla1.cod_clasificacion, "Promocion")</span></li>
                                                            }
                                                        }
                                                    </ul>
                                                }
                                            </li>
                                            }
                                        }
                                    </ul>
                                </li>
                                }
                            }
                            @if (!Session["empresa"].Equals("passarini"))
                            {				
                                <li><a href="#" id="promo">Nueva Promocion</a></li>
                            }
                        </ul>   
                    }
                    else if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString() == "Cotizacion")
                    {
                    
                       <h1 style="text-align: center;">
                            Módulo de cotización</h1>
                        if ((String)Session["accion"] == "nuevaCotPlantilla")
                        {
                        <h4 style="text-align: center; border-bottom: 2px solid black;">Plantilla</h4>
                        }
                        else if ((String)Session["accion"] == "Index")
                        {
                        <h4 style="text-align: center; border-bottom: 2px solid black;">Cotizaciones</h4>
                        }
                        else if ((String)Session["accion"] == "nueva")
                        {
                        <h4 style="text-align: center; border-bottom: 2px solid black;">Nueva Cotización</h4>
                        }
                        <ul class="sidemenu">
                            <li>@Html.ActionLink("Nueva Cotización", "nueva", "Cotizacion")</li>
                            <li>@Html.ActionLink("Cotizacion con Plantilla", "nuevaCotPlantilla", "Cotizacion")</li>
                            <!--<li>@Html.ActionLink("Cotizaciones con Promocion", "nueva", "Cotizacion")</li>-->
                            <li>@Html.ActionLink("Cotizaciones", "Index", "Cotizacion")</li>
                            
                        </ul>        
                    
                    }
                    else if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString() == "Administracion")
                    {
                        <h1 style="text-align: center;">
                            Módulo de administración</h1>
                       
                        <h4 style="text-align: center; border-bottom: 2px solid black;">
                         @{ var informacion = ViewContext.Controller.ValueProvider.GetValue("action").RawValue.Equals("FiltrarId")? "Index": (String)ViewContext.Controller.ValueProvider.GetValue("action").RawValue; }@informacion
                        </h4>
                        <ul class="sidemenu">
                            <li>@Html.ActionLink("Resumen por asesores", "asesores", "Administracion")</li>
                            <li>@Html.ActionLink("Plantillas", "Plantillas", "Administracion")</li>
                            <li>@Html.ActionLink("Cotizaciones", "Cotizaciones", "Administracion")</li>
                             <li>@Html.ActionLink("Destinos", "Destinos", "Administracion")</li>
                        </ul>
                    }
                    else
                    {
                     	
                        <h1>
                            Datos personales</h1>
                        <ul class="sidemenu">
                            <li>@Html.ActionLink("Datos de perfil", "perfil", "Sesion")</li>
                            @if ((int)Session["rol"] == 2)
                            {
                            <li>@Html.ActionLink("Usuarios " + Session["empresa"].ToString(), "ListarUsuarios", "Home")</li>
                            }
                            <li>@Html.ActionLink("Clasificaciones ", "Clasificaciones", "Home")</li>
                            <li>@Html.ActionLink("Monedas ", "Monedas", "Home")</li>
                            <li>@Html.ActionLink("Galeria de Imagenes " + Session["empresa"].ToString(), "Recursos", "Home")</li>
                        </ul>	     
                    
                    }
                    }
                    <!-- sidebar ends -->
                </div>
		
                <!--
            		<div id="rightcolumn">
		
			<h1>Support Styleshout</h1>
			<p>If you are interested in supporting my work and would like to contribute, you are
			welcome to make a small donation through the 
			<a href="http://www.styleshout.com/">donate link</a> on my website - it will 
			be a great help and will surely be appreciated.</p>
			
			<h1>Header Text</h1>
			<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. 
			Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu 
			posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum 
			odio, ac blandit ante orci ut diam. Cras fringilla magna. Phasellus suscipit, leo a pharetra 
			condimentum, lorem tellus eleifend magna, eget fringilla velit magna id neque. Curabitur vel urna. 
			In tristique orci porttitor ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. 
			Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu 
			posuere nunc justo tempus leo. </p>				
			
            
            		
		</div>-->
		
                
                } 
            }
            <div id="main">
                @if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString() == "Administracion" && Session["action"] != "Destinos" && Session["accion"] != "CotPlantilla")
                {
                    Html.RenderAction("filtros", "Administracion");
                }
                else if (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString() == "Cotizacion" && !(ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString() == "nueva") && !(ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString() == "EditarCotizacion") && Session["accion"] != "CotPlantilla")
                {

                    using (Html.BeginForm("FiltrarId", "Cotizacion", FormMethod.Post))
                    {
                    <table>
                    <tr>
                        <th>Id:</th><th></th>
                        </tr>
                        <tr>
                        <td><input type="text" name="id" size="4" /></td>
                        <td><input type="submit" value="Filtrar"/></td>
                    </tr>
                    </table>
                    }

                    <!--
                    using (Html.BeginForm("FiltrarStatus", "Cotizacion", new AjaxOptions { UpdateTargetId = "lista_cotizaciones" }))
                    {
                    <table>
                    <tr>
                        <th>Status:</th><th></th>
                        </tr>
                        <tr>
                        <td> @Html.DropDownList("status", new SelectList(elstatus, "Text", "Value"))</td>
                        <td><input type="submit" value="Filtrar"/></td>
                    </tr>
                    </table>
                    }
                    -->
                    
                    
                      using (Html.BeginForm("filtrarCotizaciones", "Cotizacion", new AjaxOptions { UpdateTargetId = "lista_cotizaciones" }))
                      { 
        <table>
            <tr>
                <th>
                    Destinos 
                </th>
                <th>
                    Temporadas
                </th>
                <th>
                    Año
                </th>
                
                <th>
                    
                </th>
               
            </tr>
            <tr>
                <td>
                    @Html.DropDownList("destino", new SelectList(ViewBag.destinos, "Id", "nombre_destino"))
                </td>
                <td>
                    @Html.DropDownList("temporada", new SelectList(ViewBag.temporadas, "Id", "nombre_temporada"))
                </td>
                <td>
                    @Html.DropDownList("anio", new SelectList(ViewBag.anios, "Text", "Value"))
                </td>
                 <td>
                    <input type="hidden" name="accion" value="@ViewContext.Controller.ValueProvider.GetValue("action").RawValue"><input type="submit" value="Filtrar" />
                </td>
            </tr>
        </table>

                      }


    using (Html.BeginForm("filtrartitulo", "Cotizacion", FormMethod.Post))
    {
            <table>
            <tr>
            <th>
                    Título
                </th>
                <th>
                </th>
            </tr>
            <tr>
            <td>
                    @Html.Editor("titulo")
                </td>
                 <td>
                    <input type="hidden" name="accion" value="@ViewContext.Controller.ValueProvider.GetValue("action").RawValue"><input type="submit" value="Filtrar" />
                </td>
            </tr>
        </table>
        
    }
    using (Html.BeginForm("filtrarCotizaciones2", "Cotizacion",FormMethod.Post))
    { 
        <table>
            <tr>
                <th>
                    Asesor
                </th>
                <th>
                    Status
                </th>
                <th></th>
            </tr>
            <tr>
                <td>
                    @Html.DropDownList("asesores", new SelectList(ViewBag.asesores, "cod_usuario", "nombre"))
                </td>
                <td>
                     @Html.DropDownList("status", new SelectList(elstatus, "Text", "Value"))
                </td>
                <td>
                    <input type="hidden" name="accion" value="@ViewContext.Controller.ValueProvider.GetValue("action").RawValue"> <input type="submit" value="Filtrar" />
                </td>
            </tr>
        </table>

    }








                }
                @RenderBody()
            </div>
            <!-- content-wrap ends-->
        </div>
        @{
            Html.RenderPartial("~/Views/Shared/footer.cshtml");          
        }
        <!-- wrap ends here -->
    </div>
</body>
<script type="text/javascript">
    var ventanas = new Array(12);
    var i = 0;

    $(function () {

        /*$(".scrollable").scrollable();*/
        $("#browser").treeview({
            persist: "location",
            collapsed: true,
            unique: true
        });
        var dockOptions =
    { align: 'middle' // horizontal menu, with expansion UP/DOWN from the middle
    , fadeIn: 2000 // fade in over 2 seconds
    };

        $.ajax({
            url: '/Sesion/Count/',
            success: function (data) {
                if (data != 0) {
                    // ...and apply...
                    $('#menufooter').jqDock(dockOptions);
                }
            }
        })




        inicial_x = 300;
        inicial_y = 270;

        ventanas[0] = "vacio";
        /*aqui obtengo de la bd las promociones que se manejan*/
        //alert($("#main").css('margin-top'));


        $("#promo").click(function () {
            ventanas[i] = "v_" + i;
            //esto debe crearse dependiendo de los nombres de los anteriores :)
            i = i + 1;

            $.newWindow({
                id: i,
                title: "v_" + i,
                width: 100,
                height: 100,
                posx: inicial_x,
                posy: inicial_y,
                content: "",
                onDragBegin: null,
                onDragEnd: function () {
                    /*   var ancho = $("#main").css('margin-left');
                    var alto = $("#main").css('top');

                    mov1 = $("#" + $(this)[0].id).css("top");
                    mov = $("#" + $(this)[0].id).css("left");
                    //alert(mov1);
                    mov1 = $("#" + $(this)[0].id).css("top");
                    mov = eval(mov.split("px")[0]);

                    if (mov < 450 || mov > 950) {
                    $.moveWindow($(this)[0].id, $(this)[0].posx, $(this)[0].posy);
                    }

                    if (mov1 < 358 || mov1 > 811) {
                    $.moveWindow($(this)[0].id, $(this)[0].posx, $(this)[0].posy);
                    }*/
                },
                onResizeBegin: null,
                onResizeEnd: null,
                statusBar: true,
                minimizeButton: true,
                maximizeButton: true,
                closeButton: true,
                draggable: true,
                resizeable: true,
                type: "normal", // "normal" or "iframe"
                modal: false
            });


            $.updateWindowContent(i, '<iframe src="http://localhost:54740/Promocion/crear/" width="1200" height="830" />');

        });



    });

   

 
</script>
</html>
